#include "Subsystems/BlockBehaviors/SubsystemInWaterBlockBehavior.h"
#include "Blocks/FluidBlock.h"
#include "Blocks/WaterBlock.h"

namespace PocketSurvival
{
    SubsystemInWaterBlockBehavior::SubsystemInWaterBlockBehavior()
    {
        m_handleBlocks.clear();
    }

    void SubsystemInWaterBlockBehavior::onItemHarvested(int32_t x, int32_t y, int32_t z, int32_t blockValue, BlockDropValue &outDropValue, int32_t &outNewBlockValue)
    {
        int32_t level = FluidBlock::GetLevel(Terrain::ExtractData(blockValue));
        outNewBlockValue = Terrain::MakeBlockValue(WaterBlock::Index(), 0, FluidBlock::SetLevel(0, level));
        outDropValue.value = Terrain::MakeBlockValue(Terrain::ExtractContents(blockValue));
        outDropValue.count = 1;
    }

    
} // namespace PocketSurvival
